package com.pricl.frame.query.criteria;

import java.util.List;

public class Criterion {

	private String condition;
	private Object value;
	private Object secondValue;
	private boolean noValue;
	private boolean singleValue;
	private boolean betweenValue;
	private boolean listValue;
	private String typeHandler;

	public Criterion(String condition) {
		this.condition = condition;
		this.typeHandler = null;
		this.noValue = true;
	}

	public Criterion(String condition, Object value, String typeHandler) {
		this.condition = condition;
		this.value = value;
		this.typeHandler = typeHandler;
		if ((value instanceof List))
			this.listValue = true;
		else
			this.singleValue = true;
	}

	public Criterion(String condition, Object value) {
		this(condition, value, null);
	}

	public Criterion(String condition, Object value, Object secondValue, String typeHandler) {
		this.condition = condition;
		this.value = value;
		this.secondValue = secondValue;
		this.typeHandler = typeHandler;
		this.betweenValue = true;
	}

	public Criterion(String condition, Object value, Object secondValue) {
		this(condition, value, secondValue, null);
	}

	public String getCondition() {
		return this.condition;
	}

	public Object getValue() {
		return this.value;
	}

	public Object getSecondValue() {
		return this.secondValue;
	}

	public boolean isNoValue() {
		return this.noValue;
	}

	public boolean isSingleValue() {
		return this.singleValue;
	}

	public boolean isBetweenValue() {
		return this.betweenValue;
	}

	public boolean isListValue() {
		return this.listValue;
	}

	public String getTypeHandler() {
		return this.typeHandler;
	}
}
